package com.mengtian_tech.tju.dataquery.api;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.mengtian_tech.tju.dataquery.api.util.SpringUtil;
import tju.utils.EnvTool;

@SpringBootApplication(scanBasePackages = { "com.mengtian_tech.tju.dataquery.api",
		"com.mengtian_tech.tju.dataquery.api.controller" })
@EnableTransactionManagement
@EnableScheduling
public class Application {

	public static void main(String[] args) {
		String profile = "server";
		if (EnvTool.isDevMode()) { // 开发环境
			profile = "local";
		}

		System.out.println("load profile=" + profile);

		ApplicationContext ctx = new SpringApplicationBuilder(Application.class).profiles(profile).run(args);

		SpringUtil.setContext(ctx);

		 
		
		Runtime.getRuntime().addShutdownHook(new Thread(() -> {
			System.out.println("jvm Shutting down application...");
		}));

	}

}
